5.2.3 [5] <5.1> References to which variables exhibit spatial locality?
Locality is affected by both the reference order and data layout. The same computation can also be written below in Matlab, which differs from C by contiguously storing matrix elements within the same column.
a. for I=1:8
for J=1:8000
A(I,J)=B(I,0)+A(J,I);
end
end
b. for J=1:8000
for I=1:8
A(I,J)=B(I,0)+A(J,I);
end
end
 
 
View Solution
 
 
 
<< Back Next >>